package dome1;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * Date: 2023-06-28
 * Time: 14:41
 */
public class Test3 {
    public int removeDuplicates(int[] nums) {
        int i = 0;
        int j = 1;
        while(j < nums.length) {
            if(nums[i] == nums[j]) {
                j++;
            } else {
                nums[i+1] = nums[j];
                j++;
                i++;
            }
        }
        return ++i;
    }

    public static void main(String[] args) {
        int[] ret = {1,1,2};
        Test3 test3 = new Test3();
        System.out.println(test3.removeDuplicates(ret));
    }
}
